/* ************************************************************************

   Copyright:

   License:

   Authors:

************************************************************************ */

/* ************************************************************************

#asset(viaticos/*)

************************************************************************ */

/**
 * This is the main application class of your custom application "viaticos"
 */
qx.Class.define("viaticos.Application",
{
  extend : qx.application.Standalone,



  /*
  *****************************************************************************
     MEMBERS
  *****************************************************************************
  */

  members :
  {
    /**
     * This method contains the initial application code and gets called 
     * during startup of the application
     * 
     * @lint ignoreDeprecated(alert)
     */
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        // support native logging capabilities, e.g. Firebug for Firefox
        qx.log.appender.Native;
        // support additional cross-browser console. Press F7 to toggle visibility
        qx.log.appender.Console;
      }

      /*
      -------------------------------------------------------------------------
        Below is your actual application code...
      -------------------------------------------------------------------------
      */


	var doc = this.getRoot();

      
      
	var contenedorMain = new qx.ui.container.Composite(new qx.ui.layout.Grow());
	var tabviewMain = this._tabviewMain = new qx.ui.tabview.TabView();
	
	var pagePrincipal = this._pagePrincipal = new viaticos.viaticos.pagePrincipal(this);
	tabviewMain.add(pagePrincipal);
	
	contenedorMain.add(tabviewMain);
	
	
	var mnuArchivo = new qx.ui.menu.Menu();
	var btnAcercaDe = new qx.ui.menu.Button("Acerca de...");
	btnAcercaDe.addListener("execute", function(){

	});
	mnuArchivo.add(btnAcercaDe);
	
	var mnuEdicion = new qx.ui.menu.Menu();
	var btnMotivos = new qx.ui.menu.Button("Motivos");
	btnMotivos.addListener("execute", function(e){
		var window = new viaticos.viaticos.windowMotivos(this);
		window.setModal(true);
		doc.add(window);
		window.center();
		window.open();
	}, this);
	mnuEdicion.add(btnMotivos);
	
	var btnParamet = new qx.ui.menu.Button("Parámetros");
	btnParamet.addListener("execute", function(e){
		var window = new viaticos.viaticos.windowParamet(this);
		window.setModal(true);
		doc.add(window);
		window.center();
		window.open();
	}, this);
	mnuEdicion.add(btnParamet);
	  
	var mnuVer = new qx.ui.menu.Menu();

	var btnConsultas = new qx.ui.menu.Button("Consultas");
	btnConsultas.addListener("execute", function(e){
		var window = new viaticos.viaticos.windowConsultas(this);
		window.setModal(true);
		doc.add(window);
		window.center();
		window.open();
	}, this);
	mnuVer.add(btnConsultas);
	
	
	var mnubtnArchivo = new qx.ui.toolbar.MenuButton('Archivo');
	var mnubtnEdicion = new qx.ui.toolbar.MenuButton('Edición');
	var mnubtnVer = new qx.ui.toolbar.MenuButton('Ver');
	
	mnubtnArchivo.setMenu(mnuArchivo);
	mnubtnEdicion.setMenu(mnuEdicion);
	mnubtnVer.setMenu(mnuVer);
	  
	var toolbarMain = new qx.ui.toolbar.ToolBar();
	toolbarMain.add(mnubtnArchivo);
	toolbarMain.add(mnubtnEdicion);
	toolbarMain.add(mnubtnVer);
	
	doc.add(toolbarMain, {left: 5, top: 5, right: 5});
	
	doc.add(contenedorMain, {left: 0, top: 38, right: 0, bottom: 0});
	
    }
  }
});
